/**
 * 拼接分页请求参数
 * @param page
 * @param size
 * @returns {string}
 */
function getPageQueryStr(page, size) {
    return "page=" + (page ? (page + "") : ("0")) + "&size=" + (size ? (size + "") : ("20"))
}

/**
 * 将参数中的空字符串删除
 * @param data
 */
function clearEmptyValue(data) {
    for (var i in data) {
        if (data[i] === "") {
            delete data[i];
        }
    }
    return data;
}

/**
 * 获取URL中单个参数
 * @param paramName
 */
function getParam(paramName) {
    var paramValue = "", isFound = !1;
    var searchString = decodeURI(location.search);
    if (searchString.indexOf("?") == 0 && searchString.indexOf("=") > 1) {
        var arrSource = unescape(searchString).substring(1, searchString.length).split("&"), i = 0;
        while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
    }
    return paramValue == "" && (paramValue = null), paramValue
}


function getParams() {
    var data = {};
    $(".seachform input , .seachform select ").each(function () {
        var type = $(this).attr("type");
        if (type != 'button') {
            var val = $(this).val();
            if (val) {
                var id = $(this).attr("id");
                data[id] = val;
            }
        }
    });
    return data;
}


function getParamList() {
    var arr = [];
    $(".forminfo input,.forminfo select , .forminfo textarea ").each(function () {
        var type = $(this).attr("type");
        if (type != 'button') {
            var val = $(this).val();
            var data = {};
            var id = $(this).attr("id");
            if (id) {
                data['id'] = $(this).attr("id");
                data['val'] = $(this).val();
                if ($(this).prev("label").text().replace('*', '')) {
                    data['name'] = $(this).prev("label").text().replace('*', '');
                } else {
                    data['name'] = $(this).attr("name");
                }
                arr.push(data);
            }
        }
    });
    return arr;
}

Date.prototype.Format = function (fmt) { //author: meizz
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "h+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}